Don't save menu bar events that land on the menu bar itself
authorPo Lu <luangruo@yahoo.com>
Mon, 28 Feb 2022 01:40:01 +0000 (09:40 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 28 Feb 2022 01:40:01 +0000 (09:40 +0800)
* src/xterm.c (handle_one_xevent): Ignore menu bar events which
land on the menu bar itself instead of a button.

src/xterm.c

index 2656b30472da8a39c09a2cedabbf50e82ece5707..520de5fcf0f353e17333e9d79f5e22d0f067c4c2 100644 (file)
@@ -11112,12 +11112,26 @@ handle_one_xevent (struct x_display_info *dpyinfo,
             && event->xbutton.y < FRAME_MENUBAR_HEIGHT (f)
             && event->xbutton.same_screen)
           {
-           if (!f->output_data.x->saved_menu_event)
-             f->output_data.x->saved_menu_event = xmalloc (sizeof *event);
-           *f->output_data.x->saved_menu_event = *event;
-           inev.ie.kind = MENU_BAR_ACTIVATE_EVENT;
-           XSETFRAME (inev.ie.frame_or_window, f);
-           *finish = X_EVENT_DROP;
+#ifdef USE_MOTIF
+           unsigned char column_type;
+           Widget widget;
+
+           widget = XtWindowToWidget (dpyinfo->display,
+                                      event->xbutton.window);
+           XtVaGetValues (widget, XmNrowColumnType, &column_type, NULL);
+
+           if (column_type != XmMENU_BAR)
+             {
+#endif
+               if (!f->output_data.x->saved_menu_event)
+                 f->output_data.x->saved_menu_event = xmalloc (sizeof *event);
+               *f->output_data.x->saved_menu_event = *event;
+               inev.ie.kind = MENU_BAR_ACTIVATE_EVENT;
+               XSETFRAME (inev.ie.frame_or_window, f);
+               *finish = X_EVENT_DROP;
+#ifdef USE_MOTIF
+             }
+#endif
           }
         else
           goto OTHER;